package com.mlk.core.component.permission;

import com.mlk.core.exception.ParamException;
import com.mlk.core.util.DeptUtils;
import com.mlk.core.util.SessionUtils;
import com.mlk.rbac.po.SysDept;

import java.util.Objects;

/**
 * 部门数据权限sql格式化器
 * @author xulu
 */
public class DeptDataPermissionSqlFormat extends DataPermissionSqlFormat {
    /**
     * 部门权限格式化sql
     */
    public static final String SQL = " select * from (  %s  ) trekxu where trekxu.dept_level like concat('%s', '%%') ";

    @Override
    public String formatSql(String sourceSql) {
        return String.format(SQL, sourceSql, SessionUtils.getDept().getLevel());
    }

}